package isvp.utilities;

import java.io.File;

import javax.swing.filechooser.FileFilter;

public class ExtensionFileFilter extends FileFilter {
  private String description = "ISVP Files";

  private String extension = "isvp";
  
  @Override
  public String getDescription() {
    return description;
  }

  @Override
  public boolean accept(File file) {
    if (file.isDirectory()) {
      return true;
    } else {
      String path = file.getAbsolutePath().toLowerCase();
      if (path.endsWith(extension) && (path.charAt(path.length() - extension.length() - 1)) == '.') {
          return true;
        }
    }
    return false;
  }
}